package com.mazaiting.mail.utils;

import com.mazaiting.mail.domain.vo.MailVO;

/**
 * @title: FromUtil
 * @Author danghailiang
 * @Date: 2022/4/13 22:58
 * @Version 1.0
 */
public class FromUtil {

    /**
     * 构建html页面，发送邮件
     * @param mailVO 发送信息，此处可以更改，暂时这样
     * @return 返回html的StringBuffer字符串
     */
    public static StringBuffer getFrom(MailVO mailVO){
        StringBuffer sb = new StringBuffer();
                sb.append("<div style=\"width:100%;background:#eee;text-align:center;\">\n" +
                        "        <div style=\"width:600px;text-align:center;margin:0 auto;\">\n" +
                        "            <table align=\"center\" width=\"100%\" style=\"font-family:'Microsoft YaHei';font-size:12px;background-color:#eee;color:#373d41;\" cellpadding=\"0\" cellspacing=\"0\">\n" +
                        "                <tbody>\n" +
                        "                    <tr>\n" +
                        "                        <td>\n" +
                        "                            <table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"background-color:#fff;margin:0 auto;\">\n" +
                        "                                <tbody>\n" +
                        "                                    <tr>\n" +
                        "                                        <td style=\"width:600px;height:40px;background-color:#eee;text-align:center;line-height:40px;\">&nbsp;&nbsp; </td>\n" +
                        "                                    </tr>\n" +
                        "                                    <tr>\n" +
                        "                                        <td style=\"width:600px;background-color:#eee;text-align:center;\">\n" +
                        "                                            <img src=\"https://img.alicdn.com/tfs/TB1RnWyL8LoK1RjSZFuXXXn0XXa-133-31.png\">\n" +
                        "                                        </td>\n" +
                        "                                    </tr>\n" +
                        "                                    <tr>\n" +
                        "                                        <td style=\"width:600px;height:40px;background-color:#eee;text-align:center;line-height:40px;\">&nbsp;&nbsp; </td>\n" +
                        "                                    </tr>\n" +
                        "                                </tbody>\n" +
                        "                            </table>\n" +
                        "\n" +
                        "\n" +
                        "\n" +
                        "                            <table width=\"600\" style=\"background-color:#fff;margin:0 auto;\" cellpadding=\"0\" cellspacing=\"0\">\n" +
                        "                                <tbody><tr>\n" +
                        "                                    <td>\n" +
                        "\n" +
                        "\n" +
                        "\n" +
                        ""+ mailVO.getContent() +"\n" +
                        "\n" +
                        "\n" +
                        "                                        \n" +
                        "                                    </td>\n" +
                        "                                </tr>\n" +
                        "                            </tbody></table>\n" +
                        "                            \n" +
                        "                            <table width=\"600\" cellpadding=\"0\" cellspacing=\"0\" style=\"margin:0 auto;\">\n" +
                        "                                <tbody>\n" +
                        "                                    <tr>\n" +
                        "                                        <td style=\"width:600px;height:25px;line-height:25px;\">&nbsp;&nbsp; </td>\n" +
                        "                                    </tr>\n" +
                        "                                    <tr>\n" +
                        "                                        <td style=\"width:600px;height:20px;text-align:center;line-height:20px;\">\n" +
                        "                                            <a target=\"_blank\" style=\"color:#00c1de;border-right:1px solid #cacaca;padding-right:12px;padding-left:12px;text-decoration: none;color: #00c1de;font-size:12px;\" href=\"https://www.aliyun.com/?&amp;msctype=email&amp;mscareaid=cn&amp;mscsiteid=cn&amp;mscmsgid=9100122030900197317&amp;&amp;spm=a2c4k.12299055.zh-cnt.3&amp;\" rel=\"noopener\">APOLLO官网 </a>\n" +
                        "                                            <a target=\"_blank\" style=\"color:#00c1de;padding-right:30px;padding-left:12px;text-decoration: none;color: #00c1de;font-size:12px;\" href=\"https://help.aliyun.com/?&amp;msctype=email&amp;mscareaid=cn&amp;mscsiteid=cn&amp;mscmsgid=9100122030900197317&amp;&amp;spm=a2c4k.12299055.zh-cnt.4&amp;\" rel=\"noopener\">帮助中心</a>\n" +
                        "                                            <img src=\"https://img.alicdn.com/tfs/TB1l7VvRpXXXXbFaXXXXXXXXXXX-30-30.png\" style=\"height:15px;vertical-align:middle;margin-right:8px;\">\n" +
                        "                                            <span style=\"color:#73777a;font-size:12px;\">APOLLO售前咨询：95187转1</span>\n" +
                        "                                        </td>\n" +
                        "                                    </tr>\n" +
                        "                                    <tr>\n" +
                        "                                        <td style=\"width:600px;height:25px;line-height:25px;\">&nbsp;&nbsp; </td>\n" +
                        "                                    </tr>\n" +
                        "                                    <tr>\n" +
                        "                                        <td style=\"width:600px;height:28px;line-height:28px;\">\n" +
                        "                                            <div style=\"color:#9b9ea0;line-height:20px;\">\n" +
                        "                                                <div style=\"text-align:center;font-size:12px;\"> 如果您不想再接收APOLLO的「产品到期通知」邮件，或者需要设置其他人接收，点此<a href=\"https://account.aliyun.com/login/login.htm?&amp;msctype=email&amp;mscareaid=cn&amp;mscsiteid=cn&amp;mscmsgid=9100122030900197317&amp;oauth_callback=https%3a%2f%2fnotifications.console.aliyun.com%2f%23%2fsubscribeMsg%3fmessageTypeId%3dprod_msg_expire\" target=\"_blank\" style=\"text-decoration:none; color:#00a2ca;\" rel=\"noopener\">设置订阅。</a></div>\n" +
                        "                                                <div style=\"text-align:center;font-size:12px;margin-top:5px;\">Copyright © APOLLO &nbsp;2009-2021 All Right Reserved </div>\n" +
                        "                                            </div>\n" +
                        "                                        </td>\n" +
                        "                                    </tr>\n" +
                        "                                    <tr>\n" +
                        "                                        <td style=\"height:15px;\">&nbsp;</td>\n" +
                        "                                    </tr>\n" +
                        "                                    <tr>\n" +
                        "                                        <td style=\"width:600px;text-align:center;\">\n" +
                        "                                            <img src=\"https://img.alicdn.com/tfs/TB1wZDUdf9TBuNjy0FcXXbeiFXa-240-130.png\">\n" +
                        "                                        </td>\n" +
                        "                                    </tr>\n" +
                        "                                    <tr>\n" +
                        "                                        <td style=\"height:80px;\">&nbsp;</td>\n" +
                        "                                    </tr>\n" +
                        "                                </tbody>\n" +
                        "                            </table>\n" +
                        "                            \n" +
                        "                        </td>\n" +
                        "                    </tr>\n" +
                        "                </tbody>\n" +
                        "            </table>\n" +
                        "        </div>\n" +
                        "    </div>");

        return sb;
    }
}
